package com.whitecat.voting.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.whitecat.voting.dto.wx.SessionKey;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

@ApiModel(value = "MpRegisterParam", description = "小程序用户注册参数")
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class MpRegisterParam {

    @ApiModelProperty(name = "code", value = "微信授权码，32个字符。", example = "061piPdG1TwW660gJveG1w2QdG1piPdV")
    @Length(max = 32, min = 32, message = "code必须是32个字符！")
    private String code;

    @ApiModelProperty(name = "data", value = "被加密的数据。")
    @NotNull
    private String data;

    @ApiModelProperty(name = "iv", value = "Initial Vector，24个字符。", example = "r7BXXKkLb8qrSNn05n0qiA==")
    @Length(max = 24, min = 24, message = "iv必须是24个字符！")
    private String iv;

    @JsonIgnore
    private SessionKey sessionKey;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getIv() {
        return iv;
    }

    public void setIv(String iv) {
        this.iv = iv;
    }

    public SessionKey getSessionKey() {
        return sessionKey;
    }

    public void setSessionKey(SessionKey sessionKey) {
        this.sessionKey = sessionKey;
    }
}